Enemy = class("Enemy", HPlane)

function Enemy:ctor(hp, speed, fireRate, tag, prefab)
    self.super.ctor(self, hp, speed, fireRate, tag, prefab)

    self.rigid = self.gameObject:GetComponent('Rigidbody2D');
    self.rigid.velocity = -self.transform.up*speed;

    self.firePoint1=self.transform:Find("FirePions/FirePoint1");
    self.firePoint2=self.transform:Find("FirePions/FirePoint2");
    self.firePoint3=self.transform:Find("FirePions/FirePoint3");

end


function Enemy:Fire()
    local bullet1 = Bullet.new(self.firePoint1, 10, "EnemyBullet", ThunderManager.prefabs[4]);

    local bullet2 = Bullet.new(self.firePoint2, 10, "EnemyBullet", ThunderManager.prefabs[5]);

    local bullet3 = Bullet.new(self.firePoint3, 10, "EnemyBullet",ThunderManager.prefabs[5]);

end

function Enemy:OnTriggerEnter2D(collider)
    self.super.OnTriggerEnter2D(self, collider);

    if  self.gameObject:CompareTag("Enemy") then
        if  collider.gameObject:CompareTag("PlayerBullet") then
            destroy(collider.gameObject)

            self:SubHp() 

            if self:IsDath() then
                ThunderManager.AddScore(1);
            end
            ThunderManager.AddScore(1);
            
        elseif collider.gameObject:CompareTag("Player") then
            
        
        end
    end
end